package com.jrx.anytxn.transaction.job.chargeoffProcess.step;

import com.jrx.anytxn.transaction.entity.TlPaymentLog;
import com.jrx.anytxn.transaction.mapper.ext.ExtTlPaymentLogMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 核销扣款writer
 */
@Service
public class ChargeOffPayWriter implements ItemWriter<TlPaymentLog> {

    @Resource
    private ExtTlPaymentLogMapper extTlPaymentLogMapper;

    @Override
    public void write(List<? extends TlPaymentLog> items) {
        if(CollectionUtils.isNotEmpty(items)){
            extTlPaymentLogMapper.batchUpdateLogForBatch((List<TlPaymentLog>)items);
        }
    }
}
